Hampshire Crime Analysis

My local town, Havant is the second safest major town in Hampshire, and is the 30th most dangerous overall out of Hampshire's 268 towns, villages, and cities. The overall crime rate in Havant in 2023 was 93 crimes per 1,000 people. This compares poorly to Hampshire's overall crime rate, coming in 14% higher than the Hampshire rate of 81 per 1,000 daytime population. For England, Wales, and Northern Ireland as a whole, Havant is the 30th safest major town, and the 1,281st most dangerous location out of all towns, cities, and villages.

In January 2024, Havant was the worst major town in Hampshire for drugs, with 35 crimes reported and a crime rate of 0.31 per 1,000 daytime population. January 2024 was also a bad month for Havant residents, when it was Hampshire's most dangerous major town for other crime, recording 14 crimes at a rate of 0.13 per 1,000 daytime population.

The most common crimes in Havant are violence and sexual offences, with 5,092 offences during 2023, giving a crime rate of 46. This is 8% lower than 2022's figure of 5,533 offences and a difference of 3.96 from 2022's crime rate of 50. Havant's least common crime is theft from the person, with 44 offences recorded in 2023, a decrease of 24% from 2022's figure of 58 crimes.

This notebook has a look at the crime stats for all districts in Hampshire as a whole (including 11 districts and two unitary authorities) to see if there are any patterns or interesting insights. We will then home in on Havant to see if we can conclude anything about the crimes reported in this town.

Crimes

Data Sources:

Crime Tree

Hampshire Reported Street Crimes

Crime and Safety Havant

Population - census

Economic Indicators

Import data

Data Cleaning

It is not entirely clear why there are so many blanks as there is a category for 'under investigation' and it might be assumed that there should be an outcome for all cases

We have data from April 2021 through to March 2025, so we have three years of complete data. We will focus in on 2022,2023 and 2024 and drop the rest of the data from the dataset.

It seems as if we have some LSOA names that are not Hampshire. We are interested in those that relate to Hampshire only. Lets have a look at one of these other ones.

Lower Layer Super Output Areas (LSOAs): LSOAs have an average population of 1500 people or 650 households. A lot more data is available directly at LSOA level, including the majority of the data included within our tool, Local Insight.

Districts:

We can look up the LSOA codes for each of these from here

Some of the questions/issues we might want to ask/investigate based on the data:

Total Crimes by Year

Types of crimes

We have 14 categories of crime which we can consolidate a bit to make analysis easier.

The most commonly occurring crime is violence and sexual offences violent and sexual crimes include: domestic abuse, rape, sexual offences, stalking, harassment, so-called 'honour-based' violence including forced marriage, female genital mutilation, child abuse, human trafficking focusing on sexual exploitation, prostitution, pornography and obscenity.

We can see that violence is the biggest category by far and possession of weapons is the smallest of the reported crimes

Types of crimes by year

This table highlights some interesting changes over the period.

Portsmouth News Article

The proportions of each type of crime per year have remained fairly stable over the period

Types of crimes by month

Does the pattern of total crime vary by month?

Does the pattern of different types of crime vary by month?

There is no significant pattern, other than we can see that total reported crimes are highest in July and lowest in December.

We can see if there are any noticeable patterns with regard to types of crime by month

We can see this a little better if we plot each of these crime types separately

Pattern of crimes by month:

Crimes by district

To analyse the crimes by district, we can filter by the LSOA codes we used earlier.

We can see that the largest offences are reported in the two largest towns/cities in Hampshire, Portsmouth and Southampton with violence and sexual offences being the largest category. The lowest number of crimes is reported in Hart, a rural district.

Relationship between crimes

There is pretty strong correlation between different types of crime being reported in a district. This is what we might expect. For example drugs offences are highly positively correlated with theft, violence, possession of weapons and anti-social behaviour. Shoplifting and burglary are less highly correlated.

What are the hotspots for particular crimes?

Look at the top three districts for each type of crime reported. We might expect Southampton, Portsmouth and Basingstoke to be the highest on all crimes but there may be some differences in the results.

Crime categories where other districts feature

The New Forest is an area that receives a lot of visitors and there are a lot of expensive homes in this district too. This could explain it being a hotspot for these types of crimes

Rushmoor encompasses the towns of Farnborough and Aldershot, both military areas but it is not clear why it appears in third place for shoplifting

Lets plot this on a map. We are using the full dataframe here with latitude and longitude and crimes cover the two year period of 2022 and 2023.

We can clearly see the hotspots in Hampshire on the map and these are clustered around the major connurbations as we might expect

There are some hotspot areas in the Havant district that we can narrow down to locations

There are a couple of locations of interest

We can see that most of these involve violence and sexual offences, followed by anti-social and public order and shoplifting. We could try to narrow this down a little more.

This LSOA is actually in Waterlooville, a nearby town to Havant but in the Havant and Waterlooville District

This first line doesn't provide much information, although we can see a couple of locations of interest which are around the central town shopping area

In this area, anti-social and public order offences are the top reported crime. Again, violence and shoplifting are also top reported crimes for this LSOA.

As before, there is not much information regarding the location name but we can see from the map the hotpspot areas which are again focussed primarily on the shopping centre areas

Economic Indicators

It might be interesting to have a look at some other economic indicators such as unemployment rates, median incomes or education to try to build up a picture by district and see if there are any obvious links between crime rate and other factors. From this we might be able to build up a model.

We will look at:

These are the latest available from this link

Lets try clustering on this data

We can see that there is a relationship between these two crimes and two points are well apart from the others

The connurbations of Portsmouth and Southampton are quite distinct from the other districts in Hampshire in terms of the level of crimes reported

Build predictive model for crime based on economic indicators

There is a fairly strong correlations between the total average crimes and unemployment rate and population density, such that higher population density and unemployment rates are correlated with higher number of crimes. The correlation with median salary is weak negative, such that a higher salary is correlated with a lower crime rate.

We will have a look at the plots

We will try to build a model but recognising that we have very few data points so it is unlikely to be a good model. We would need data from across the UK to build something we could rely upon. However, it is interesting to have a look

This is the percentage of the variation in crime which can be explained by the features of population density, median income and unemployment rate. The remaining percentage cannot be explained by our model.

We have two residuals way above the others, indicating the model underpredicted crime for those areas based on median salary

Comment as above

Comment as above

It seems as if the two outliers (Portsmouth and Southampton) have average crimes a lot higher than the others and so the model is struggling to predict, especially since the training set is so small. Where these datapoints end up in the training or test set will affect the model.

This is a poor predictive model, explaining little more than we would expect by chance. A much bigger sample size would be needed to build a model and make reliable conclusions about crime levels being related to the features we identified and likely a whole host of different predictor variables would be needed making this quite a complicated model. We wouldn't want to drop the two cities as they are important and we dont have enough data to run as two separate models so we can try a robust linear regression

Robust Linear Regression

Based on z-scores, Southampton is an outlier in the data.

Robust regression offers an alternative to traditional least squares regression by relaxing some of its strict assumptions. Unlike least squares, which can be heavily influenced by outliers, robust methods are designed to reduce their impact, allowing the model to better represent the majority of the data.

Outliers in least squares regression can disproportionately skew the model, pulling the regression line toward them and receiving more weight than they should. In contrast, robust regression down-weights these extreme values, making their residuals larger and more noticeable — which helps with identifying and diagnosing them more effectively.

This hasnt improved the results

Exclude Southampton

The R2 has not improved after excluding Southampton

We have improved the results slightly on the model including Southampton but not much. We can conclude that there are many other factors involved and not just the simple model with have built including population density, unemployment rate and median income